# Maintainer: Alexey Pavlov <alexpux@gmail.com>
# Maintainer: Chilledheart <rwindz0@gmail.com>
# Contributor: Andrew Sun <adsun701@gmail.com>

_realname=jansson
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=2.12
pkgrel=1
pkgdesc="A C library for encoding, decoding and manipulating JSON data (mingw-w64)"
arch=('any')
url="http://www.digip.org/jansson/"
license=('MIT')
source=("http://www.digip.org/${_realname}/releases/${_realname}-${pkgver}.tar.gz")
sha256sums=('5f8dec765048efac5d919aded51b26a32a05397ea207aa769ff6b53c7027d2c9')

prepare() {
  cd "${srcdir}/${_realname}-$pkgver"
}

build() {
  [[ -d "${srcdir}/build-${MINGW_CHOST}" ]] && rm -rf "${srcdir}/build-${MINGW_CHOST}"
  mkdir -p "${srcdir}/build-${MINGW_CHOST}"
  cd "${srcdir}/build-${MINGW_CHOST}"
  ../${_realname}-${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --target=${MINGW_CHOST}
  make
}

package() {
  cd "${srcdir}/build-${MINGW_CHOST}"
  make DESTDIR="${pkgdir}" install
}
